<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>16.7.DOM-事件高级-鼠标操作-禁止选中文字和禁止右键菜单</title>
    <style>

    </style>
</head>

<body>
    此文字不能分享,无法右键上下文,禁止选中
    <script>
        // contextmenu 可以禁用右键菜单
        document.addEventListener('contextmenu', function (e) {
            e.preventDefault();
        })
        // selectstart 禁止选中文字
        document.addEventListener('selectstart', function (e) {
            e.preventDefault();
        })
    </script>
</body>

</html>